<?php
class login extends baseController {    
	public function __construct() {
		parent::__construct ();
	}
    
    public function index() {
        if(!$_POST) {
            $this->session->unset_userdata('username');
            $this->load->view('login', null);
            return;   
        }
        $username = $this->accountModel->login($_POST['username'], md5($_POST['passwordd']));
        //$account = array('username' => 'admin');
        if($username) {
            $this->session->set_userdata('username', $username);
            redirect(base_url().'admin/language');
        } else {
            $this->session->set_flashdata('message', 'Username or password is incorrect.');
            redirect(base_url().'login/index');   
        }
    }
}
?>